package com.zoshine.zzg.controller;

import com.github.pagehelper.PageInfo;
import com.zoshine.zzg.base.BaseResponse;
import com.zoshine.zzg.pojo.OrderSupplierDetail;
import com.zoshine.zzg.respons.AppResponse;
import com.zoshine.zzg.service.OrderSupplierDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 待发货管理Controller
 * @author 田沛凌
 * @time 2017年6月26日 下午4:03:40
 */
@RestController
@RequestMapping(value="deliver", method = RequestMethod.POST)
public class DeliverController extends BaseController{

	private OrderSupplierDetailService orderSupplierDetailService;
	@Autowired
	public void setOrderSupplierDetailService(OrderSupplierDetailService orderSupplierDetailService) {
		this.orderSupplierDetailService = orderSupplierDetailService;
	}


	/**
	 * 待发货单分页查询
	 * @param orderSupplierDetail；
	 * @return 订单集合
	 */
	@RequestMapping("/pageDeliver")
	public BaseResponse pageDeliver(Long id){
		List<Long> prisonPower = super.getPrisonPower();
		List<Long> supplierPower = super.getSupplierPower();
		OrderSupplierDetail orderSupplierDetail =new OrderSupplierDetail();
		orderSupplierDetail.setPrisonPower(prisonPower);
		orderSupplierDetail.setSupplierPower(supplierPower);
		orderSupplierDetail.setOrderSupplierId(id);
		List<OrderSupplierDetail> pageList = orderSupplierDetailService.selectDeliverList(orderSupplierDetail);
		return new AppResponse(new PageInfo<>(pageList));
	}

}

